package pathfinding.grid;

import pathfinding.core.Location;

public class GridLocation implements Location{
	
	private int x;
	private int y;
	private boolean end;
	private double value;
	
	public GridLocation(int x, int y, boolean end, double value){
		this.x = x;
		this.y = y;
		this.end = end;
		this.value = value;
	}
	
	//---------------- Method for finding a path ------------------------------
	
	public int getCellX(){ return x; }
	
	public int getCellY(){ return y; }
	
	public boolean isEnd(){ return end; }
	
	public double getValue(){ return value; }
	
	//-------------- Method for moving a mover around this path ---------------
	
	public double getCenterX() { return x + 0.5; }
	
	public double getCenterY() { return y + 0.5; }
	
	public double getMinX() { return x; }
	
	public double getMinY() { return y; }
	
	public double getMaxX() { return x+1; }
	
	public double getMaxY() { return y+1; }
	
	public boolean contains(double x, double y){
		if ((getMinX() <= x && getMaxX() >= x) && (getMinY() <= y && getMaxY() >= y)) {
			return true;
		}
		return false;
	}
	
	@Override
	public String toString(){
		String result = "";
		result += "GridLocation(" + x +" ," + y + ")";
		return result;
	}

}
